package com.dog.basics.admin.controller.mtkj;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.mtkj.ShopOrderFromDto;
import com.dog.basics.bean.vo.admin.mtkj.AdminShopOrderXqVo;
import com.dog.basics.bean.vo.admin.mtkj.ShopOrderVo;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.mtkj.IMtOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author wph
 * @since 2020-11-09
 */
@RestController
@RequestMapping("/pc/order")
@Api(value = "商城订单模块", tags = "商城订单模块")
@AllArgsConstructor
public class MtOrderController {
    private final IMtOrderService mtOrderService;

    /**
     * @Description: 获取商品订单列表
     * @Param: CashWithdrawalAddDto
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/29  0027
     */
    @ApiOperation(value = "获取商品订单列表", notes = "pc:order:page")
    @GetMapping
    @PreAuthorize("@pms.hasPermission('pc:order:page')")
    public R<IPage<ShopOrderVo>> save(PageParam page, ShopOrderFromDto obj) {
        return R.ok(mtOrderService.getPageList(page, obj));
    }

    /**
     * @Description: 订单详情
     * @Param: CashWithdrawalAddDto
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/29  0027
     */
    @ApiOperation(value = "订单详情", notes = "pc:order:getObjXq")
    @GetMapping("/{id}")
    @PreAuthorize("@pms.hasPermission('pc:order:getObjXq')")
    @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long")
    public R<AdminShopOrderXqVo> getObjXq(@PathVariable("id") Long id) {
        return R.ok(mtOrderService.getObjXq(id));
    }
}


